home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / wgraf102.zip / WARPGRAF.DOC < prev    next >
Text File  |  1991-02-02  |  12KB  |  424 lines

  1.                        The Warp Graphics Library
  2.  
  3.                               Version 1.02
  4.  
  5.                                 written
  6.  
  7.                                    by
  8.  
  9.                               Trevor Bell
  10.  
  11.                              Copyright 1991
  12.  
  13.  
  14. WHAT IT IS:
  15.  
  16.         The Warp Graphics Library is a full-featured graphics library.
  17. Do not be fooled by the small file sizes, the binary drivers are
  18. written in assembly language and the libraries are in well-optimized
  19. C++, contributing to the small sizes.
  20.         It supports both EGA and VGA graphics modes.  It has support for
  21. multiple open windows, scrolling up and down in windows, line drawing,
  22. box drawing, highlighting areas of the screen, saving and restoring
  23. windows, and many other features.  A small demonstration program is
  24. provided to show off some of these features and you may modify it.
  25.  
  26.         Warp Graphics is NOT PUBLIC DOMAIN, Warp Graphics IS SHAREWARE.  A
  27. registration fee of $50 (of course I won't mind if you send more than
  28. $50) is required if you wish to use Warp Graphics in any application to be
  29. distributed to the general public.  Registration will get you the full
  30. source code for the Turbo C++ libraries and library files for each of the
  31. 6 memory models (tiny, small, medium, compact, large, huge), and
  32. the source code for the driver files (VGA.BIN and EGA.BIN).  Without
  33. registration you will be limited to compiling programs in the small
  34. memory model and this will substantially limit programs.  By registering
  35. this program you will be contributing to the release of future versions
  36. of Warp Graphics and future programs that I will be creating.  Your
  37. registration will be greatly appreciated.  See the file ORDER.FRM for
  38. details on registering.
  39.  
  40. Registrations may be sent to:
  41.  
  42.         Trevor Bell
  43.         P.O. Box 4173
  44.         Redondo Beach, CA  90278
  45.  
  46. I can be contacted on The Source BBS at 213-371-3737 or on The General
  47. Store BBS at 213-371-2550.
  48.  
  49.  
  50.  
  51. HOW TO USE IT:
  52.  
  53. --------------------------------------------------------------------------------
  54.  
  55.               Using the Warp Graphics Library in Turbo C++
  56.  
  57. --------------------------------------------------------------------------------
  58.  
  59. The file GRAPH.HPP must be included into any C++ file in which you wish
  60. to use the Warp Graphics library and WGRAPHS.LIB must be linked into the
  61. EXE file.
  62.  
  63.  
  64. Initializing the graphics driver:
  65. ---------------------------------
  66.  
  67. main_gui.read(char *path);
  68.  
  69. Before any graphics operations are performed the graphics driver must be
  70. initialized.  To do this simply put the line above with the path to the
  71. proper graphics driver, like this:
  72.  
  73. for VGA only:
  74.  
  75. main_gui.read("VGA.BIN");
  76.  
  77. or for EGA only:
  78.  
  79. main_gui.read("EGA.BIN");
  80.  
  81.  
  82. Setting the graphics mode:
  83. --------------------------
  84.  
  85. main_gui.set_mode();
  86.  
  87. Issuing the command above will set the appropriate graphics mode for the
  88. driver that has been loaded into memory.  Warp Graphics operates in
  89. 640 X 350 X 16 colors in EGA mode and 640 X 480 X 16 colors in VGA mode.
  90.  
  91.  
  92. Restoring the text mode:
  93. ------------------------
  94.  
  95. main_gui.text_mode();
  96.  
  97. Issuing the command above will restore the standard text mode when you
  98. wish to exit the program.
  99.  
  100.  
  101. Filling the screen:
  102. -------------------
  103.  
  104. main_gui.fill_screen(unsigned char color)
  105.  
  106. Issuing the above command with an appropriate argument will clear the
  107. screen to the selected color.  It can be used like this:
  108.  
  109. main_gui.fill_screen(1);
  110.  
  111. This will fill the screen with a dark blue color.
  112.  
  113.  
  114. Saving the screen:
  115. ------------------
  116.  
  117. main_gui.save_screen()
  118.  
  119. Issuing the above command will save the current graphics screen to a
  120. memory buffer for later restoration.  In the small memory model you will
  121. not be able to save the screen because there is not enough available
  122. memory.
  123.  
  124.  
  125. Restoring the screen:
  126. ---------------------
  127.  
  128. main_gui.restore_screen()
  129.  
  130. Issuing the above command will restore a previously saved graphics
  131. screen.  In the small memory model you will not be able to restore the
  132. screen because there is not enough memory available to save the screen
  133. in the first place.
  134.  
  135.  
  136. Scrolling an area of the screen:
  137. --------------------------------
  138.  
  139. main_gui.scroll(unsigned int x1, unsigned int y1, unsigned int x2,
  140.     unsigned int y2, unsigned char color, int lines);
  141.  
  142. Issuing the above command with the appropriate arguments will scroll the
  143. screen.  The x and y arguments represent coordinate values on the
  144. screen.  The lines argument is the number of scan lines you wish to
  145. scroll the screen, a positive value in this field will scroll the screen
  146. upward and a negative value will scroll it downward.
  147.  
  148. To scroll the screen upward fifteen lines in EGA mode and clear the
  149. unused portion of the screen to black would be accomplished like this:
  150.  
  151. main_gui.scroll(0, 0, 640, 349, 0, 15);
  152.  
  153.  
  154. Drawing a point:
  155. ----------------
  156.  
  157. void point::put(unsigned int x, unsigned int y, unsigned char color);
  158.  
  159. To draw a point, a structure of type point must first be defined like this:
  160.  
  161. point point_structure;
  162.  
  163. Then the following command can be issued to draw a point in bright white:
  164.  
  165. point_structure.put(0,0,20,0,15);
  166.  
  167.  
  168. Drawing a line:
  169. ---------------
  170.  
  171. void line::put(unsigned int x1, unsigned int y1, unsigned int x2,
  172.     unsigned int y2, unsigned char color);
  173.  
  174. To draw a line, a structure of type line must first be defined like this:
  175.  
  176. line line_structure;
  177.  
  178. Then the following command can be issued to draw a horizontal line in
  179. bright white:
  180.  
  181. line_structure.put(0,0,20,0,15);
  182.  
  183.  
  184. Loading fonts:
  185. --------------
  186.  
  187. A font structure must be defined before any fonts can be loaded, like
  188. this:
  189.  
  190. font type_face(8,15);
  191.  
  192. Then the fontpointer variable must be loaded with the address of this
  193. new font structure like this:
  194.  
  195. fontpointer =& type_face;
  196.  
  197. Then the font must be loaded into memory like this:
  198.  
  199. fontpointer->load_font("STANDARD.FNT");
  200.  
  201. Only one font is provided in the unregistered version, however 40 fonts
  202. are provided in the registered version.
  203.  
  204.  
  205. Drawing boxes:
  206. --------------
  207.  
  208. Before any boxes can be drawn, a structure of type boxes must be defined
  209. like this:
  210.  
  211. boxes box_structure;
  212.  
  213.  
  214. Drawing an unfilled box:
  215. ------------------------
  216.  
  217. After defining a box structure the following command can be issued to
  218. draw an unfilled box of the color white:
  219.  
  220. box_structure.box(0,0,50,50,15);
  221.  
  222.  
  223. Drawing a filled box:
  224. ---------------------
  225.  
  226. After defining a box structure the following command can be issued to
  227. draw a filled box of the color white:
  228.  
  229. box_structure.filled_box(0,0,50,50,15);
  230.  
  231.  
  232. Drawing a radio button:
  233. -----------------------
  234.  
  235. After defining a box structure the following command can be issued to
  236. draw a radio button:
  237.  
  238. box_structure.radio_button("Button",0,0,50,50);
  239.  
  240.  
  241. Drawing a checked box:
  242. ----------------------
  243.  
  244. After defining a box structure the following command can be issued to
  245. draw a checked box in the color white:
  246.  
  247. box_structure.check_box("Checked Box  ",0,0,15);
  248.  
  249.  
  250. Creating a window:
  251. ------------------
  252.  
  253. windows::windows(unsigned int xx1, unsigned int yy1, unsigned int xx2,
  254.     unsigned int yy2, unsigned char color, unsigned char background,
  255.     enum opts options);
  256.  
  257. The first four arguments are simply coordinate values, the next two
  258. represent the foreground and background colors of the window.  The last
  259. argument is an enumerated type which allows you to set several options
  260. in the window, including horizontal centering, vertical centering, auto
  261. downward scrolling, and auto upward scrolling.
  262.  
  263. To create a window, a structure of type windows must be defined like
  264. this:
  265.  
  266. windows new_window(0,0,50,50,7,0,window::none);
  267.  
  268. Then the windowpointer variable must be assigned to the window, like
  269. this:
  270.  
  271. windowpointer =& new_window;
  272.  
  273. Then the window should be reset like this:
  274.  
  275. windowpointer->reset();
  276.  
  277.  
  278. Putting a border on the window:
  279. -------------------------------
  280.  
  281. void windows::border(unsigned char color, unsigned char color2,
  282.     unsigned int width);
  283.  
  284. After a window has been defined, a border can be put around it with one
  285. color on the top and left edges and another color on the bottom and
  286. right edges to provide a sort of shadow effect.  The last argument
  287. represents the width of the window's border. This can be set like
  288. this:
  289.  
  290. windowpointer->border(15,8,3);
  291.  
  292.  
  293. Putting text in the window:
  294. ---------------------------
  295.  
  296. void windows::text(char *text, unsigned int andwith, unsigned int x,
  297.     unsigned int y, unsigned char color, unsigned char background);
  298.  
  299. The text variable represents a text string to be placed in the window,
  300. the andwith variable determines whether the background variable is used
  301. or not.  The x and y variables determine the location of the string on
  302. the screen, and the color and background variables determine the
  303. foreground and background colors of the text.
  304.  
  305. A character string in bright white can be placed in the window like this:
  306.  
  307. windowpointer->text("Text string.",0,0,0,15,0);
  308.  
  309.  
  310. Scrolling the window:
  311. ---------------------
  312.  
  313. void windows::scroll(int lines);
  314.  
  315. The window can be scrolled with the scroll command.  Putting a positive
  316. value for lines will scroll the screen upward, while a negative value
  317. will scroll it downward.
  318.  
  319. The window could be scrolled upward 15 lines like this:
  320.  
  321. windowpointer->scroll(15);
  322.  
  323.  
  324. Saving a window:
  325. ----------------
  326.  
  327. void windows::save(void);
  328.  
  329. Issuing the above command will save the current window to a
  330. memory buffer for later restoration.  In the small memory model you will
  331. not be able to save the window because there is not enough available
  332. memory.
  333.  
  334. Saving the window is accomplished like this:
  335.  
  336. windowpointer->save();
  337.  
  338.  
  339. Restoring a window:
  340. -------------------
  341.  
  342. void windows::restore(void);
  343.  
  344. Issuing the above command will restore a previously saved window.
  345. In the small memory model you will not be able to restore the
  346. window because there is not enough memory available to save the window
  347. in the first place.
  348.  
  349. Restoring the window is accomplished like this:
  350.  
  351. windowpointer->restore();
  352.  
  353.  
  354. Putting a cursor in the window:
  355. -------------------------------
  356.  
  357. void windows::put_cursor(unsigned int x, unsigned int y, unsigned char color);
  358.  
  359. A bright white cursor can be placed in the window like this:
  360.  
  361. windowpointer->put_cursor(0,0,15);
  362.  
  363.  
  364. Removing a cursor from the window:
  365. -------------------------------
  366.  
  367. void windows::remove_cursor(unsigned int x, unsigned int y,
  368.         unsigned char background);
  369.  
  370. A cursor can be removed from the window like this:
  371.  
  372. windowpointer->remove_cursor();
  373.  
  374.  
  375. --------------------------------------------------------------------------------
  376.  
  377.                              CODE EXAMPLES
  378.  
  379. --------------------------------------------------------------------------------
  380.  
  381.  
  382. A very simple demo program is provided with Warp Graphics to demonstrate
  383. it's capabilities very minimally.  Feel free to modify it to your
  384. heart's desire, keep in mind however that without registration your
  385. program will need to remain within the small memory model.
  386.  
  387. The source code for this program is provided in the file DEMO.CPP
  388. Turbo C++.
  389.  
  390.  
  391.  
  392. --------------------------------------------------------------------------------
  393.  
  394.                                 SUPPORT
  395.  
  396. --------------------------------------------------------------------------------
  397.  
  398.  
  399. Support can be obtained through mail sent to my P.O. Box or by calling the
  400. following BBSs:
  401.  
  402.         The Source   HST Dual Standard  -  A WildCat! BBS
  403.         213-371-3737
  404.  
  405.         The General Store BBS   FidoNet Node 1:102/134  - A RemoteAccess BBS
  406.         213-371-2550
  407.  
  408. --------------------------------------------------------------------------------
  409.  
  410.                             VERSION HISTORY
  411.  
  412. --------------------------------------------------------------------------------
  413.  
  414.  
  415. Version 1.00:
  416.         not released to the public
  417.  
  418. Version 1.01:
  419.         My first release!
  420.  
  421. Version 1.02:
  422.         I forgot to include the fonts in the ZIP file (whoops!).
  423.  
  424.